package com.dlyk.web;

import com.dlyk.result.ChartData;
import com.dlyk.result.R;
import com.dlyk.result.SummaryData;
import com.dlyk.service.StatisticService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 统计（概览统计、图表统计）
 */
@RestController
public class StatisticController {

    @Resource
    private StatisticService statisticService;

    /**
     * 加载概览统计数据
     */
    @GetMapping("/api/statistic/summary/data")
    public R loadSummaryData() {

        SummaryData statisticData = statisticService.getSummaryData();

        return R.OK(statisticData);
    }

    /**
     * 加载销售漏斗图表数据
     */
    @GetMapping("/api/statistic/saleFunnelChart/data")
    public R loadSaleFunnelChartData() {

        List<ChartData> chartDataList = statisticService.getSaleFunnelChartData();

        return R.OK(chartDataList);
    }

    /**
     * 加载线索来源统计饼图数据
     */
    @GetMapping("/api/statistic/clueSourcePieChart/data")
    public R loadClueSourcePieChartData() {

        List<ChartData> chartDataList = statisticService.getClueSourcePieChartData();

        return R.OK(chartDataList);
    }

    /**
     * 加载市场活动数据统计柱状图
     */
    @GetMapping("/api/statistic/activityBarChart/data")
    public R loadActivityBarChartData() {

        List<ChartData> chartDataList = statisticService.getActivityBarChartData();

        return R.OK(chartDataList);
    }

    /**
     * 加载交易数据统计折线图
     */
    @GetMapping("/api/statistic/tranLineChart/data")
    public R loadTranLineChart() {

        List<ChartData> chartDataList = statisticService.getTranLineChart();

        return R.OK(chartDataList);
    }

}

